<template>
    <!-- 聊天框 -->
    <ChatPannel ref="chatPannelRef" />
    <!-- 添加好友框 -->
    <AddFriend ref="addFriendRef" />
    <FloatWin ref="floatWinRef" :can-hidden="true" :dragbar-height="80" drag-bar-ele-id="dragBar" :default-width="200"
        :default-height="600">
        <template #dragbar>
            <SelfInfoPanel />
        </template>
        <template #main>
            <MyFirendPanel :open-add-friend="openAddFriend" />
        </template>
    </FloatWin>
</template>

<script setup lang="ts">
import FloatWin from "@/UtilComponents/FloatWin.vue";
import ChatPannel from '@/components/chat/chatPanel/ChatPannel.vue'
import AddFriend from '@/components/chat/addFriendPanel/AddFriend.vue'
import eventBus from "@/Util/EventBus";
const floatWinRef = ref<InstanceType<typeof FloatWin>>()
onMounted(() => {
    eventBus.on('openChatPannel', openChatPannel)
})
const close = () => {
    (floatWinRef.value as any).isShow = false
}
const open = () => {
    (floatWinRef.value as any).isShow = true
}
const chatPannelRef = ref<InstanceType<typeof ChatPannel>>()
const addFriendRef = ref<InstanceType<typeof AddFriend>>()

const openAddFriend = () => {
    addFriendRef.value?.open()
}
const openChatPannel = () => {
    chatPannelRef.value?.open()
}

</script>


<style scoped lang="less"></style>
